#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
    int N, NA, NB, i, j;
    int numA = 0, numB = 0;  //用于记录A,B分别获胜的次数
    int a[100], b[100];  //用来记录A,B出拳的规律
    scanf("%d %d %d", &N, &NA, &NB);

    for (i = 0; i < NA; i++)
        scanf("%d", &a[i]);

    for (i = 0; i < NB; i++)
        scanf("%d", &b[i]);

    //按照A,B的出拳规律将A,B后续如何出拳补齐,直到比完N轮比赛为止
    for (j = 0, i = NA; i < N; i++, j++)
        a[i] = a[j];

    for (j = 0, i = NB; i < N; i++, j++)
        b[i] = b[j];

    //计算A,B两人获胜的次数
    for (i = 0; i < N; i++)
    {
        if ((a[i] == 0 && b[i] == 2) || (a[i] == 2 && b[i] == 5) || (a[i] == 5 && b[i] == 0))  //A赢
            numA++;
        else if ((b[i] == 0 && a[i] == 2) || (b[i] == 2 && a[i] == 5) || (b[i] == 5 && a[i] == 0))  //B赢
            numB++;
    }

    if (numA > numB)
        printf("A");
    else if (numA < numB)
        printf("B");
    else
        printf("draw");
    return 0;
}